package it.univaq.mwt.common.business;

import it.univaq.mwt.business.UserService;


public abstract class UsersServiceFactory {
	
	private static UsersServiceFactory instance;
	
	public abstract UserService getUserService();
	

	protected UsersServiceFactory() {
	}
	
	public synchronized static UsersServiceFactory getInstance() {
		if (instance==null) {
			throw new RuntimeException();
		}
		System.out.println("UserServiceFactory instance obtained");
		return instance;
		
	}
	

	public synchronized static void setInstance(UsersServiceFactory factory) {
		if (instance!=null) {
			throw new RuntimeException();
		}
		instance = factory;
		System.out.println("UserServiceFactory instance created");
		
	}
}
